﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class User_Register : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void Button2_Click(object sender, EventArgs e)
    {
        tbCPass.Text = "";
        tbPass.Text = "";
        tbName.Text = "";
        tbMail.Text = "";
        tbUsername.Text = "";
    }

    protected void Button1_Click1(object sender, EventArgs e)
    {
        String username = tbUsername.Text;
        String pass = tbPass.Text;
        String cpass = tbCPass.Text;
        String name = tbName.Text;
        String mail = tbMail.Text;
        String sex = DropDownList1.SelectedItem.Text;
        String role = DropDownList2.SelectedItem.Value;

        //DataSourceSelectArguments sc = new DataSourceSelectArguments();
        //SqlDataSource1.SelectCommand = "";

        //DataView dv = (DataView)SqlDataSource1.Select(sc);
        SqlDataSource1.InsertCommand = "INSERT INTO users (username, password, role_id, name, sex, email) VALUES ('" + username + "', '" + pass + "', '" + role + "', '" + name + "', '" + sex + "', '" + mail + "')";
        SqlDataSource1.Insert();

    }
}